package org.carota.pdf;

import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.carota.util.AliyunOSSUtils;

import java.io.ByteArrayInputStream;

/**
 * 重写toFile至oss云端
 * @author : AnWen
 * @version :1.0
 * @since : 2023-04-04 14:57
 */
@Slf4j
@NoArgsConstructor
public class OssPdfProcessor extends PdfProcessor{


    @Override
    public void toFile() {
        super.pdfClose ();
        byte[] bytes = getBos ().toByteArray ();
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream (bytes);
        String fileUri = AliyunOSSUtils.uploadFile (byteArrayInputStream);
        setOutputPdfPath (fileUri);
    }

}
